﻿Public Class frmClub


    Private Sub btnBuscar_Click(sender As System.Object, e As System.EventArgs) Handles btnBuscar.Click
        My.Forms.ClubBuscar.Show()
    End Sub

    Private Sub btnSalir_Click(sender As System.Object, e As System.EventArgs) Handles btnSalir.Click
        Dim Respuesta As Integer = MessageBox.Show("¿Esta seguro que quiere salir?", "Confirmar", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
        If Respuesta = 1 Then
            End
        End If
    End Sub


    Private Sub frmClub_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        habilitaBotones(True)
        habilitaLabels(False)
    End Sub

    Private Sub habilitaBotones(ByVal param As Boolean)
        Me.btnBuscar.Enabled = param
        Me.btnSalir.Enabled = param
        Me.btnNuevo.Enabled = param
        Me.btnGuardar.Enabled = Not (param)
        Me.btnCancelar.Enabled = Not (param)
        Me.btnAgregarImagen.Visible = Not (param)

    End Sub

    Private Sub habilitaLabels(ByVal param As Boolean)
        Me.txtCalle.Enabled = param
        Me.txtCodPostal.Enabled = param
        Me.txtCuit.Enabled = param
        Me.txtDpto.Enabled = param
        Me.txtNombreClub.Enabled = param
        Me.txtNro.Enabled = param
        Me.txtPiso.Enabled = param
        Me.dtpFechaFundacion.Enabled = param
        Me.cmbEstadoCancha.Enabled = param
        Me.cmbTipoPiso.Enabled = param

        Me.txtCalle.Text = ""
        Me.txtCodPostal.Text = ""
        Me.txtCuit.Text = ""
        Me.txtDpto.Text = ""
        Me.txtNombreClub.Text = ""
        Me.txtNro.Text = ""
        Me.txtPiso.Text = ""
        Me.dtpFechaFundacion.Text = ""
        Me.cmbEstadoCancha.Text = ""
        Me.cmbTipoPiso.Text = ""
    End Sub

    Private Sub btnNuevo_Click(sender As System.Object, e As System.EventArgs) Handles btnNuevo.Click
        habilitaLabels(True)
        habilitaBotones(False)
    End Sub

    Private Sub btnGuardar_Click(sender As System.Object, e As System.EventArgs) Handles btnGuardar.Click
        habilitaBotones(True)
        habilitaLabels(False)
    End Sub

    Private Sub btnCancelar_Click(sender As System.Object, e As System.EventArgs) Handles btnCancelar.Click
        habilitaBotones(True)
        habilitaLabels(False)
    End Sub
End Class